package com.tzt.quartz;

import org.quartz.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.SimpleDateFormat;
import java.util.Date;

public class HelloJob implements BaseJob {  
  
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    private static Logger _log = LoggerFactory.getLogger(HelloJob.class);
     
    public HelloJob() {  
          
    }  

    @Override
    public void execute(JobExecutionContext context) throws
            JobExecutionException
    {
        Date date = new Date();
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        JobKey key = context.getJobDetail().getKey();
        logger.info("定时任务：" + key.getGroup() + "开始");
        logger.info("Current Exec Time Is :" + sf.format(date));
        logger.info("My Job name and group are:" + key.getName() + ":" + key.getGroup());
        TriggerKey trkey = context.getTrigger().getKey();
        logger.info("My Trigger name and group are:" + trkey.getName() + ":" + trkey.getGroup());
        _log.info("测试");
        logger.info("定时任务：" + key.getGroup() + "结束");
    }
}  
